import { Inject, Injectable } from '@nestjs/common';
import { NacosNamingClient } from 'nacos';

@Injectable()
export class NacosService {

    @Inject('NACOS_CLIENT')
    private client: NacosNamingClient;

    // 注册
    async register(serviceName, instance) {
        await this.client.registerInstance(serviceName, instance);
    }

    // 取消注册
    async deregister(serviceName, instance) {
        await this.client.deregisterInstance(serviceName, instance);
    }


}
